//ACCEPTED
#include <cstdio>
#include <iostream>
#include <list>
#include <utility>
#include <map>
using namespace std;

int n, a, b, c, d, i, j, k;
map< int, pair<int, int> > m;
list<int> l;
list<int>::iterator it;


void read(){
	scanf("%d", &n);
	for(i=0;i<n;i++){
		scanf("%d %d", &a, &b);
		if(m[a].first==0){
			//printf("opa\n");
			l.push_back(a);
			m[a].first=b;
		}
		else {
			m[a].second = b;
		}

		if(m[b].first==0){
			//printf("opa\n");
			l.push_back(b);
			m[b].first=a;
		}
		else {
			m[b].second = a;
		}
	}
}
void process(){
	for (it = l.begin(); m[*it].second; it++);
	c = j = *it;
	printf("%d ",j);
	j = m[j].first;
	while(m[j].second!=0){
		printf("%d ",j);
		k=m[j].first;
		if(k!=c){
			c=j;
			j = k;
		}
		else {
			c=j;
			j = m[j].second;
		}
		
	};
	printf("%d ",j);
}

int main(){
	//freopen("in.txt", "r", stdin);freopen("out.txt", "w", stdout);
	
	read();
	process();
	return 0;
}
